{% extends "base.html" %}

{% block title %}添加报警规则{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">添加报警规则</h4>
                </div>
                <div class="card-body">
                    <form method="POST">
                        <div class="mb-3">
                            <label for="point_id" class="form-label">监控点</label>
                            <select class="form-select" id="point_id" name="point_id" required>
                                <option value="">请选择监控点</option>
                                {% for point in points %}
                                <option value="{{ point.id }}">{{ point.name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="mb-3">
                            <label for="parameter" class="form-label">监控参数</label>
                            <select class="form-select" id="parameter" name="parameter" required>
                                <option value="">请选择参数</option>
                                <option value="dissolved_oxygen">溶解氧</option>
                                <option value="ph_value">pH值</option>
                                <option value="temperature">温度</option>
                                <option value="ammonia_nitrogen">氨氮</option>
                                <option value="turbidity">浊度</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label for="min_value" class="form-label">最小值</label>
                            <input type="number" step="0.01" class="form-control" id="min_value" name="min_value" required>
                        </div>
                        <div class="mb-3">
                            <label for="max_value" class="form-label">最大值</label>
                            <input type="number" step="0.01" class="form-control" id="max_value" name="max_value" required>
                        </div>
                        <div class="mb-3">
                            <label for="level" class="form-label">报警级别</label>
                            <select class="form-select" id="level" name="level" required>
                                <option value="warning">警告</option>
                                <option value="danger">危险</option>
                            </select>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">添加</button>
                            <a href="{{ url_for('alarm.rules') }}" class="btn btn-secondary">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 